package com.salton123.lib_database.db.entity

import android.graphics.drawable.Drawable
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.Ignore
import androidx.room.Index

/**
 * Time:5/9/21 7:07 PM
 * Author:
 * Description:
 */
@Entity(tableName = "apk_entity", primaryKeys = ["packageName"],
    indices = [Index(value = ["packageName"], unique = true)]
)
data class ApkEntity(
    @ColumnInfo(name = "packageName") val packageName: String,
    @ColumnInfo(name = "name") val name: String,
    @ColumnInfo(name = "sourceDir") val sourceDir: String,
    @ColumnInfo(name = "path") val path: String,
    @ColumnInfo(name = "versionName") val versionName: String
) {

    @Ignore
    var isSelected: Boolean = false

    @Ignore
    var drawable: Drawable? = null

    override fun equals(other: Any?): Boolean {
        return packageName == (other as ApkEntity).packageName
    }
}